function *g1(){
  yield 2;
  yield 3;
  yield 4;
}

function *g2(){
  yield 1;

  yield g1();
  //↑ 这样写就和普通的 yield xx 一样, 将g1的运行结果作为此次it.next()的返回值中的value
  //↓ 这样写就相当于把 *g1展开 放在这里
  yield* g1();

  yield 5;

  return 'end'
}

const it = g2()
console.log(it.next()); //{ value: 1, done: false }
console.log(it.next())  //{ value: 2, done: false }
console.log(it.next()); //{ value: 3, done: false }
console.log(it.next()); //{ value: 4, done: false }
console.log(it.next()); //{ value: 5, done: false }
console.log(it.next()); //{ value: 'end', done: true }
